﻿#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
void find(int str[],int len, int* pNum1, int* pNum2)
{
	int tmp = 0;
	//整体异或
	for (int i = 0; i < len; i++)
	{
		tmp ^= str[i];
	}
	int count = 0;
	//找出不同的位置
	for (int i = 0; i < 32; i++)
	{
		if ((tmp >> i)&1 == 1)
		{
			count++;
			break;
		}
	}
	//分成两组
	for (int i = 0; i < len; i++)
	{
		if ((str[i] >> count) & 1 == 1)
		{
			*pNum1 ^= str[i];
		}
		else
		{
			*pNum2 ^= str[i];
		}
	}
}
int main()
{
	int arr[10] = { 1,2,3,4,5,6,1,2,3,4 };
	int ret1 = 0, ret2 = 0;
	int len = sizeof(arr)/sizeof(arr[0]);
	find(arr,len,&ret1,&ret2);
	printf("%d %d\n", ret1, ret2);
	return 0;
}